import { Get, Controller, Post, Body, Query, Param } from '@nestjs/common';
import { CustomerService } from './customer.service';
import { UserService2 } from '../user/user.service';
import { CreateCustomerDto } from './dto/create-customer.dto';

@Controller('customer')
export class CustomerController {
  constructor(
    private readonly customerService: CustomerService,
    private readonly userService2: UserService2,
  ) {}
  @Get('/')
  findOne() {
    return 'this is customer';
  }
  @Post('/use/:name')
  findCustomerName(
    @Query() query: CreateCustomerDto,
    @Body() body: CreateCustomerDto,
    @Param() param: { name: string },
  ) {
    console.log(JSON.stringify(param.name, null, 2));
    console.log(JSON.stringify(body, null, 2));
    console.log(JSON.stringify(query, null, 2));
    return this.customerService.getCustomer(body);
  }
  @Get('/3')
  findOne3() {
    return this.userService2.getUser('/customer/3');
  }

  @Post('/allList')
  findAll() {
    return [
      {
        name: 'zs',
        age: 23,
        gender: 'male',
      },
      {
        name: 'ls',
        age: 24,
        gender: 'female',
      },
    ];
  }
}
